#pragma once
#include <QDialog>
#include <QLabel>
#include <QPainter>
#include <QMovie>
#include <QTimer>

enum ZWaitDlgCloseVal { ZWD_SUCCESS, ZWD_FAILD, ZWD_OUTTIME };
class ZWaitDlg : public QDialog
{
	Q_OBJECT
private:
	ZWaitDlg(QWidget *parent = 0);
	~ZWaitDlg(void);

public:
	static ZWaitDlg& instance();

public:
	void Destory();

public:
	void ShowWaitWnd(int iOutTime_ms = 15000);
	void CloseWaitWnd(ZWaitDlgCloseVal closeVal);
	ZWaitDlgCloseVal GetCloseVal() const;

private slots:
	void _onTimeOut();

private:
	virtual void reject();
	virtual void closeEvent(QCloseEvent* pCloseEvent);

private:
	QMovie*				m_pMovie;
	QLabel*				m_pLabel;
	ZWaitDlgCloseVal	m_closeVal;
	QTimer				m_timer;
	bool				m_bCanClose;
};

#define g_waitDlg ZWaitDlg::instance()